import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lily
 * Date: 2024-09-22
 * Time: 19:06
 */
public class test_1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            int b = in.nextInt();
            int sum=0;
            for (int i = a; i < b+1; i++) {
                sum+=get_2_num(i);
            }
            System.out.println(sum);
        }
    }

    public static int get_2_num(int n) {
        int ret = 0;
        while (n > 0) {
            if (n % 10 == 2) {
                ret++;
            }
            n /= 10;
        }
        return ret;
    }
}
